import request from '@/utils/request'

const serviceName = '/basedata'

export function getRoutes() {
  return request({
    url: '/vue-element-admin/routes',
    method: 'get'
  })
}

export function getRoles() {
  return request({
    url: `${serviceName}/role/list'`,
    method: 'get'
  })
}

export function addRole(data) {
  return request({
    url: '/vue-element-admin/role',
    method: 'post',
    data
  })
}

export function updateRole(id, data) {
  return request({
    url: `/vue-element-admin/role/${id}`,
    method: 'put',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `/vue-element-admin/role/${id}`,
    method: 'delete'
  })
}

export function page(data) {
  return request({
    url: `${serviceName}/role/page`,
    method: 'get',
    params: data
  })
}

export function getListByUser(data) {
  return request({
    url: `${serviceName}/role/list/user`,
    method: 'get',
    params: data
  })
}

export function create(data) {
  return request({
    url: `${serviceName}/role/create`,
    method: 'post',
    data
  })
}

export function update(data) {
  return request({
    url: `${serviceName}/role/update`,
    method: 'post',
    data
  })
}

export function setStatus(data) {
  return request({
    url: '/post/status',
    method: 'post',
    data
  })
}

